package inet.app.controller.parser;


public class Parser {
	private String NAME = "NAME";
	
	private String separator_end="\\|\\|\r\n", separator="\\|";
	private String[] data, item_first,strGiai;
	
	public Parser(){
		
	}
	public String getName(String json) {
		String name = null;
		String[] data = json.split("\\|\\|\r\n");
		if (data.length>0) {
			String[] item_first = data[0].split("\\|");
			name = item_first[0];
			return name;
		}else {
			return null;
		}
	}
	public String getMien(String json) {
		String name = null,code="";
		String[] data = json.split(separator_end);
		if (data.length>0) {
			String[] item_first = data[0].split(separator);
			name = item_first[0];
			code= item_first[3];
			return Mien(code);
		}else {
			return null;
		}
	}
	public String Mien(String code){
		if (code.contains("XSTD"))
			return "MB";
		else if(code.contains("XSBDH")||code.contains("XSDLK")||code.contains("XSDNG")||code.contains("XSDNO")||code.contains("XSGL")
			||code.contains("XSKH")||code.contains("XSKT")||code.contains("XSNT")||code.contains("XSPY")||code.contains("XSQB")||code.contains("XSQNI")||code.contains("XSQNM")||code.contains("XSQT")||code.contains("XSTTH"))
			return "MT";
		else
			return "MN";
	}
}
